﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeBase
    {
        public MajorTicks GetMajorTicks()
        {
            MajorTicks majorTicks = new MajorTicks();
            majorTicks.Visibility = IsMajorTicksEnabled ? Visibility.Visible : Visibility.Collapsed;
            majorTicks.Background = MajorTicksBackground==null? null : MajorTicksBackground.Brush;
            majorTicks.BorderBrush = MajorTicksBorderBrush==null? null : MajorTicksBorderBrush.Brush;
            majorTicks.BorderThickness = MajorTicksBorderThickness;
            majorTicks.Placement = MajorTicksPlacement;
            majorTicks.Shape = MajorTicksShape;
            majorTicks.TickLength = MajorTicksTickLength;
            majorTicks.TickWidth = MajorTicksTickWidth;

            return majorTicks;
        }
        private BrushEx majorTicksBackground;
        private BrushEx majorTicksBorderBrush;
        private Thickness majorTicksBorderThickness;
        private PlacementTypes majorTicksPlacement;
        private Shapes majorTicksShape;
        private double? majorTicksTickLength;
        private double? majorTicksTickWidth;

        [Category("主要刻度")]
        [DisplayName("主要刻度背景颜色")]
        [Description("MajorTicksBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MajorTicksBackground", "主要刻度背景颜色")]
        public BrushEx MajorTicksBackground
        {
            get
            {
                return majorTicksBackground;
            }

            set
            {
                majorTicksBackground = value;
                Refresh();
            }
        }

        [Category("主要刻度")]
        [DisplayName("主要刻度边框颜色")]
        [Description("MajorTicksBorderBrush")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MajorTicksBorderBrush", "主要刻度边框颜色")]
        public BrushEx MajorTicksBorderBrush
        {
            get
            {
                return majorTicksBorderBrush;
            }

            set
            {
                majorTicksBorderBrush = value;
                Refresh();
            }
        }

        [Category("主要刻度")]
        [DisplayName("主要刻度边框大小")]
        [Description("MajorTicksBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MajorTicksBorderThickness", "主要刻度边框大小")]
        public Thickness MajorTicksBorderThickness
        {
            get
            {
                return majorTicksBorderThickness;
            }

            set
            {
                majorTicksBorderThickness = value;
                Refresh();
            }
        }

        [Category("主要刻度")]
        [DisplayName("主要刻度位置")]
        [Description("MajorTicksPlacement")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XPlacementTypesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MajorTicksPlacement", "主要刻度位置")]
        public PlacementTypes MajorTicksPlacement
        {
            get
            {
                return majorTicksPlacement;
            }

            set
            {
                majorTicksPlacement = value;
                Refresh();
            }
        }


        [Category("主要刻度")]
        [DisplayName("主要刻度形状")]
        [Description("MajorTicksShape")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XShapesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MajorTicksShape", "主要刻度形状")]
        public Shapes MajorTicksShape
        {
            get
            {
                return majorTicksShape;
            }

            set
            {
                majorTicksShape = value;
                Refresh();
            }
        }

        [Category("主要刻度")]
        [DisplayName("主要刻度长度")]
        [Description("MajorTicksTickLength")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MajorTicksTickLength", "主要刻度长度")]
        public double? MajorTicksTickLength
        {
            get
            {
                return majorTicksTickLength;
            }

            set
            {
                majorTicksTickLength = value;
                Refresh();
            }
        }

        [Category("主要刻度")]
        [DisplayName("主要刻度宽度")]
        [Description("MajorTicksTickWidth")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MajorTicksTickWidth", "主要刻度宽度")]
        public double? MajorTicksTickWidth
        {
            get
            {
                return majorTicksTickWidth;
            }

            set
            {
                majorTicksTickWidth = value;
                Refresh();
            }
        }

        [Category("主要刻度")]
        [DisplayName("主要刻度是否显示")]
        [Description("IsMajorTicksEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "IsMajorTicksEnabled", "主要刻度是否显示")]
        public bool IsMajorTicksEnabled
        {
            get
            {
                return isMajorTicksEnabled;
            }

            set
            {
                isMajorTicksEnabled = value;
                Refresh();
            }
        }

        private bool isMajorTicksEnabled;
    }
}
